
//
//  MyAddressCell.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/5/25.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "MyAddressCell.h"
#import "AddressListModel.h"
@interface MyAddressCell()
@property (weak, nonatomic) IBOutlet UIButton *addressStateBtn;
@property (weak, nonatomic) IBOutlet UILabel *userName;
@property (weak, nonatomic) IBOutlet UILabel *phone;
@property (weak, nonatomic) IBOutlet UILabel *addressDetail;

@end
@implementation MyAddressCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)changeDefaultAddressAction:(id)sender {
    if (self.btnBlock) {
        self.btnBlock(MyAddressButtonType_changeDefault, self.indexPath);
    }
    
}

- (IBAction)editAction:(id)sender {
    if (self.btnBlock) {
        self.btnBlock(MyAddressButtonType_edit, self.indexPath);
    }
}
- (IBAction)dltAction:(id)sender {
    if (self.btnBlock) {
        self.btnBlock(MyAddressButtonType_delete, self.indexPath);
    }
}
- (void)setupAddress:(AddressModel *)model{
    self.addressDetail.text = [NSString stringWithFormat:@"%@-%@",model.location,model.detail_address];
    self.userName.text = model.consignee;
    self.phone.text = model.phone;
    BOOL isSelected = [model.is_default integerValue] == 1 ?YES:NO;
    self.addressStateBtn.selected = isSelected;
}
@end
